home *** CD-ROM | disk | FTP | other *** search
/ Graphics Plus / Graphics Plus.iso / libs / sphigs / sph_srgp.lha / srgp / examples / testeditkeyboard.c < prev    next >
Encoding:
C/C++ Source or Header  |  1992-01-09  |  1.0 KB  |  49 lines

  1. #include "srgp.h"
  2. #include <stdio.h>
  3.  
  4.  
  5.  
  6.  
  7. /* TEST OF KEYBOARD DEVICE */
  8. main(argc,argv)
  9. int argc;
  10. char **argv;
  11. {
  12.    char km[81];
  13.    int trunccount;
  14.  
  15.  
  16.    SRGP_begin (argv[0], 700,700, 3, FALSE);
  17.    SRGP_enableBlockedWait();
  18.  
  19.    SRGP_loadCommonColor (5, "maroon");
  20.    SRGP_setKeyboardEchoColor (5);
  21.  
  22.    SRGP_loadCommonColor (6, "navy");
  23.    SRGP_setColor (6);
  24.  
  25.    SRGP_setKeyboardEchoOrigin (SRGP_defPoint(100,600));
  26.    SRGP_text (SRGP_defPoint(5,650), 
  27.           "How many chars to truncate to?  (<80 please)");
  28.  
  29.    SRGP_setInputMode (KEYBOARD, EVENT);
  30.    SRGP_waitEvent(-1);
  31.    SRGP_getKeyboard (km, 81);
  32.    sscanf (km, "%d", &trunccount);
  33.  
  34.    SRGP_setKeyboardEchoOrigin (SRGP_defPoint(100,450));
  35.    SRGP_text (SRGP_defPoint(5,500), "Enter string to be truncated:");
  36.  
  37.    SRGP_waitEvent(-1);
  38.    SRGP_getKeyboard (km, trunccount+1);
  39.    SRGP_setInputMode (KEYBOARD, INACTIVE);
  40.  
  41.    SRGP_text (SRGP_defPoint(5,200), "I'm printing to stdout...");
  42.    fprintf (stderr, "Here's the truncated string: %s\n", km);
  43.  
  44.    SRGP_text (SRGP_defPoint(5,100), "Goodbye!");
  45.    sleep(3);
  46.  
  47.  
  48. }
  49.